<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    690. Employee Importance
   </h1>
   <p>
    You are given a data structure of employee information, which includes the employee's
    <b>
     unique id
    </b>
    , his
    <b>
     importance value
    </b>
    and his
    <b>
     direct
    </b>
    subordinates' id.
   </p>
   <p>
    For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee 3. They have importance value 15, 10 and 5, respectively. Then employee 1 has a data structure like [1, 15, [2]], and employee 2 has [2, 10, [3]], and employee 3 has [3, 5, []]. Note that although employee 3 is also a subordinate of employee 1, the relationship is
    <b>
     not direct
    </b>
    .
   </p>
   <p>
    Now given the employee information of a company, and an employee id, you need to return the total importance value of this employee and all his subordinates.
   </p>
   <p>
    <b>
     Example 1:
    </b>
   </p>
   <pre>
<b>Input:</b> [[1, 5, [2, 3]], [2, 3, []], [3, 3, []]], 1
<b>Output:</b> 11
<b>Explanation:</b>
Employee 1 has importance value 5, and he has two direct subordinates: employee 2 and employee 3. They both have importance value 3. So the total importance value of employee 1 is 5 + 3 + 3 = 11.
</pre>
   <p>
    &nbsp;
   </p>
   <p>
    <b>
     Note:
    </b>
   </p>
   <ol>
    <li>
     One employee has at most one
     <b>
      direct
     </b>
     leader and may have several subordinates.
    </li>
    <li>
     The maximum number of employees won't exceed 2000.
    </li>
   </ol>
   <p>
    &nbsp;
   </p>
  </div>
  <div>
   <h1 class="question_title">
    690. 员工的重要性
   </h1>
   <p>
    给定一个保存员工信息的数据结构，它包含了员工
    <strong>
     唯一的id
    </strong>
    ，
    <strong>
     重要度&nbsp;
    </strong>
    和
    <strong>
     直系下属的id
    </strong>
    。
   </p>
   <p>
    比如，员工1是员工2的领导，员工2是员工3的领导。他们相应的重要度为15, 10, 5。那么员工1的数据结构是[1, 15, [2]]，员工2的数据结构是[2, 10, [3]]，员工3的数据结构是[3, 5, []]。注意虽然员工3也是员工1的一个下属，但是由于
    <strong>
     并不是直系
    </strong>
    下属，因此没有体现在员工1的数据结构中。
   </p>
   <p>
    现在输入一个公司的所有员工信息，以及单个员工id，返回这个员工和他所有下属的重要度之和。
   </p>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre>
<strong>输入:</strong> [[1, 5, [2, 3]], [2, 3, []], [3, 3, []]], 1
<strong>输出:</strong> 11
<strong>解释:</strong>
员工1自身的重要度是5，他有两个直系下属2和3，而且2和3的重要度均为3。因此员工1的总重要度是 5 + 3 + 3 = 11。
</pre>
   <p>
    <strong>
     注意:
    </strong>
   </p>
   <ol>
    <li>
     一个员工最多有一个
     <strong>
      直系
     </strong>
     领导，但是可以有多个
     <strong>
      直系
     </strong>
     下属
    </li>
    <li>
     员工数量不超过2000。
    </li>
   </ol>
  </div>
 </body>
</html>